package net.maiworld.myshop.web.admin.dao.impl;

import net.maiworld.myshop.domain.User;
import net.maiworld.myshop.web.admin.dao.UserDao;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Repository;

@Repository
public class UserDaoImpl implements UserDao {
    private static final Logger logger = LoggerFactory.getLogger(UserDaoImpl.class);

    public User getUser(String email, String password) {
        logger.debug("调用getUser,参数为email:{},password:{}", email, password);

        User user = null;

        if("admin@163.com".equals(email)) {
            if ("admin".equals(password)) {
                user = new User();
                user.setEmail("admin@163.com");
                user.setUsername("admin");

                logger.info("成功获取{}", user.getUsername());
            }
        } else{
            logger.warn("获取失败！");
        }
        return user;
    }
}
